package cn.ibobo.lease.common.util;


import cn.ibobo.lease.common.vo.ResultVO;
import org.springframework.stereotype.Component;

/**
 * @Description
 * @Author wangbo
 * @Date Created in 2017/10/16 14:50
 * @Modified By:
 */
@Component
public class ResultVOUtil<T> {
	
	public ResultVO<T> success(Integer code, String msg) {
		ResultVO<T> resultVO = new ResultVO<T>();
		resultVO.setCode(code);
		resultVO.setMsg(msg);
		return resultVO;
	}
	
	public ResultVO<T> success(Integer code, String msg, T data) {
		ResultVO<T> resultVO = this.success(code, msg);
		resultVO.setData(data);
		return resultVO;
	}

    public ResultVO<T> error(Integer code, String msg) {
        ResultVO<T> resultVO = new ResultVO<T>();
        resultVO.setCode(code);
        resultVO.setMsg(msg);
        return resultVO;
    }
    
    public ResultVO<T> error(Integer code, String msg, T data) {
    	ResultVO<T> resultVO = this.error(code, msg);
        resultVO.setData(data);
    	resultVO.setMsg(msg);
    	return resultVO;
    }
}
